<template>
  <div class="hospitalInfoCss">
    <div class="titleCss">【测试数据】漳平市医院</div>
    <div class="smallTitleCss">
      <span>医疗卫生</span>
    </div>
    <div class="bodyCss">
      <div class="customTableCss" style="padding-bottom: 25px;border-bottom: 1px solid #f2f2f2;">
        <table border="1">
          <tbody>
            <tr>
              <td class="tableLabelCss">所在镇/街道</td>
              <td>菁城街道</td>
              <td class="tableLabelCss">联系电话</td>
              <td>18888888888</td>
            </tr>
            <tr>
              <td class="tableLabelCss">详细地址</td>
              <td colspan="3">【测试数据】漳平市桂林街道林隆南路66号</td>
            </tr>
            <tr>
              <td class="tableLabelCss">医生人数</td>
              <td>3</td>
              <td class="tableLabelCss">护士人数</td>
              <td>3</td>
            </tr>
          </tbody>
        </table>
      </div>
      <div class="bodyTitleCss">证件信息</div>
      <CertInfoCard/>
      <div class="bodyTitleCss">人员信息</div>
      <PersonInfoCard/>
      <div class="bodyTitleCss">自查自纠</div>
      <div class="tableCss">
        <el-table
          max-height="200"
          :data="tableData1"
          border
          style="width: 100%">
          <el-table-column
            prop="data1"
            label="自查自纠内容"
            min-width="100">
            <template #default="scope">
              <span :style="scope.row.data2 === 0 ? 'color:red;' : ''">
                {{ scope.row.data1 }}
              </span>
            </template>
          </el-table-column>
          <el-table-column
            prop="data2"
            label="执行状态"
            min-width="100">
            <template #default="scope">
              <span :style="scope.row.data2 === 0 ? 'color:red;' : ''">
                {{ table1data2Map[scope.row.data2] }}
              </span>
            </template>
          </el-table-column>
          <el-table-column
            prop="data3"
            label="报告日期"
            min-width="100">
            <template #default="scope">
              <span :style="scope.row.data2 === 0 ? 'color:red;' : ''">
                {{ scope.row.data3 }}
              </span>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <div class="bodyTitleCss">医疗废弃物处置记录</div>
      <div class="tableCss">
        <el-table
          max-height="200"
          :data="tableData2"
          border
          style="width: 100%">
          <el-table-column
            prop="data1"
            label="处置时间"
            min-width="100">
            <template #default="scope">
              <span :style="scope.row.data4 === 0 ? 'color:red;' : ''">
                {{ scope.row.data1 }}
              </span>
            </template>
          </el-table-column>
          <el-table-column
            prop="data2"
            label="处置类型"
            min-width="100">
            <template #default="scope">
              <span :style="scope.row.data4 === 0 ? 'color:red;' : ''">
                {{ scope.row.data4 === 0 ? '-' : table2data2Map[scope.row.data2] }}
              </span>
            </template>
          </el-table-column>
          <el-table-column
            prop="data3"
            label="处置人"
            min-width="100">
            <template #default="scope">
              <span :style="scope.row.data4 === 0 ? 'color:red;' : ''">
                {{ scope.row.data4 === 0 ? '-' : scope.row.data3 }}
              </span>
            </template>
          </el-table-column>
          <el-table-column
            prop="data4"
            label="状态"
            min-width="100">
            <template #default="scope">
              <span :style="scope.row.data4 === 0 ? 'color:red;' : ''">
                {{ table2data4Map[scope.row.data4] }}
              </span>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <div class="bodyTitleCss">开药记录</div>
      <div class="tableCss">
        <el-table
          max-height="200"
          :data="tableData3"
          border
          style="width: 100%">
          <el-table-column
            prop="data1"
            label="开药时间"
            min-width="100">
            <template #default="scope">
              <span :style="scope.row.data2 === 0 ? 'color:red;' : ''">
                {{ scope.row.data1 }}
              </span>
            </template>
          </el-table-column>
          <el-table-column
            prop="data2"
            label="状态"
            min-width="100">
            <template #default="scope">
              <span :style="scope.row.data2 === 0 ? 'color:red;' : ''">
                {{ table3data2Map[scope.row.data2] }}
              </span>
            </template>
          </el-table-column>
          <el-table-column
            prop="data3"
            label="医师类别"
            min-width="100">
            <template #default="scope">
              <span :style="scope.row.data2 === 0 ? 'color:red;' : ''">
                {{ table3data3Map[scope.row.data3] }}
              </span>
            </template>
          </el-table-column>
          <el-table-column
            prop="data4"
            label="医师专业"
            min-width="100">
            <template #default="scope">
              <span :style="scope.row.data2 === 0 ? 'color:red;' : ''">
                {{ table3data4Map[scope.row.data4] }}
              </span>
            </template>
          </el-table-column>
        </el-table>
      </div>
    </div>
    <div class="bottomBtnCss">
      <el-button @click="goBackBtn">返回</el-button>
    </div>
  </div>
</template>

<script>
import CertInfoCard from '@/views/components/pages/certInfoCard/index.vue'
import PersonInfoCard from '@/views/components/pages/personInfoCard/index.vue'
import { getCurrentDay } from '@/utils/business.js'
export default {
  components:{ CertInfoCard , PersonInfoCard},
  data(){
    return{
      mp4Url:'',
      tableData1:[],
      tableData2:[],
      tableData3:[],
      table1data2Map:{
        0:'未执行',
        1:'未发现问题',
      },
      table2data2Map:{
        0:'病理性废物',
        1:'损伤性废物',
        2:'药物性废物',
        3:'化学性废物',
      },
      table2data4Map:{
        0:'未处置',
        1:'无医疗废物处置',
        2:'已处置',
      },
      table3data2Map:{
        0:'超出执业范围（异常开药）',
        1:'正常范围',
      },
      table3data3Map:{
        0:'临床类别',
        1:'其他类别',
      },
      table3data4Map:{
        0:'内科专业',
        1:'妇产科专业',
        2:'儿科专业',
      },
    }
  },
  mounted(){
    this.getList()
  },
  methods:{
    goBackBtn(){
      this.$router.back()
    },
    getList(){
      const random = Math.floor( Math.random() * 10) + 5
      let list1 = []
      let list2 = []
      let list3 = []
      for( let i=0;i<random;i++){
        const random12 = Math.floor( Math.random() * 2)
        list1.push({
          data1: '【测试数据】自查自纠内容xxxxxx',
          data2: random12,
          data3: getCurrentDay(),
        })

        const random22 = Math.floor( Math.random() * 4) 
        const random24 = Math.floor( Math.random() * 3) 
        list2.push({
          data1: getCurrentDay(),
          data2: random22,
          data3: '【测试数据】xxx',
          data4: random24,
        })

        const random32 = Math.floor( Math.random() * 2)
        const random33 = Math.floor( Math.random() * 2) 
        const random34 = Math.floor( Math.random() * 3) 
        list3.push({
          data1: getCurrentDay(),
          data2: random32,
          data3: random33,
          data4: random34,
        })
      }
      this.tableData1 = list1
      this.tableData2 = list2
      this.tableData3 = list3
    },
  },
}
</script>

<style lang="scss" scoped>
.hospitalInfoCss{
  overflow: hidden;
  position: relative;
  background-color: #fff;
  padding: 20px;
  border-radius: 10px;
  height: calc( 100vh - 66px - 40px);
  display: flex;
  flex-direction: column;
  .titleCss{
    text-align: center;
    font-size: 24px;
    font-weight: bold;
  }
  .smallTitleCss{
    font-size: 18px;
    margin-top: 10px;
    text-align: center;
  }
  .bodyCss{
    margin-top: 20px;
    margin-left: 20px;
    width: calc( 100% - 10px);
    padding-right: 40px;
    overflow-y: auto;
    height: calc( 100% - 140px);
    padding-bottom: 20px;
    .customTableCss{
      table {
        border-collapse: collapse;
        width: 100%;
        line-height: 34px;
        &:not(:first-child){
          margin-top: 15px;
        }
        .tableLabelCss{
          font-weight: bold;
        }
        .tableValueCss{
          color: green;
          width: 200px;
          text-align: center;
          font-weight: bold;
        }
      }
      th, td {
        border: 1px solid black;
        padding: 8px;
        text-align: left;
      }
      th {
        background-color: #f2f2f2;
      }
      tr:last-child td {
        border-bottom: none;
      }
      td:nth-child(2) {
        border-right: none;
      }
    }
    .bodyTitleCss{
      text-align: center;
      font-size: 24px;
      font-weight: bold;
      margin-top: 20px;
    }
    .tableCss{
      padding-bottom: 20px;
      margin-top: 20px;
    }
  }
  .bottomBtnCss{
    margin-top: auto;
    text-align: right;
  }
}
</style>